package com.haoran.dwz.service;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.haoran.dwz.domain.entities.User;
import com.haoran.dwz.rest.R;

public interface UserService {

	User findByUsername(String username);

	User getOne(String userId);
	
	User findOne(String userId);

	Page<User> findByPageable(Pageable pageable);

	List<User> listAll();

	User add(User user);

	void deleteByUsername(String username);

	/**
	 * 初始化系统用户
	 * @param password
	 * @return
	 */
	User createRootUser(String password);
	
	void clean(String password);
	
	User cleanAndInit(String oldPwd,String newPwd);

	void grantAuthorityByUsername(String username,String number);

	void groupByUsername(String username, String number);

	void revokeRoleByUsername(String username, String number);

	void removeGroupByUsername(String username, String number);

	void disableByUsername(String username);
	
	void enabledByUsername(String username);

	void updateLastLoginTime(String id, Date date);

	void changePwd(String username,String oldPwd, String newPwd);

	Page<User> findByPageable(User user, Pageable pageable);

	R newAdd(User user);

	void deleteByUsername(String[] usernames);
}
